package com.yudean.esb.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PageUtil {
    private final static Logger LOGGER = LoggerFactory.getLogger(PageUtil.class);

    public static Integer handlePageSize(String pageNum) {
        int pageSize = 2000;
        try {
            pageSize = Integer.parseInt(pageNum);
        } catch (Exception ex) {
            LOGGER.error("转换pageSize出错!默认值1");
        }
        return Math.min(pageSize, 5000);
    }

    public static Integer handlePageNo(String page) {
        int pageNo = 1;
        try {
            pageNo = Integer.parseInt(page);
        } catch (Exception ex) {
            LOGGER.error("转换PAGE出错!默认值1");
        }
        return Math.max(pageNo, 1);
    }
}
